<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>登录</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../css/swiper.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/layer.css" />
    <link rel="stylesheet" type="text/css" href="../css/mdw.css" />
    <script type="text/javascript" src="../script/api.js"></script>
    <script type="text/javascript" src="../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../script/swiper.min.js"></script>
    <script type="text/javascript" src="../script/mobile.js"></script>
    <script type="text/javascript" src="../script/layer.js"></script>
    <script type="text/javascript" src="../script/mdw.js"></script>
    <script type="text/javascript" src="../script/jumpPage.js"></script>

</head>
<body>
    <header class="header loginHeader">
        <div class="backPrevPage" onclick="historyBack()"></div>
        <div class="pageTitle">绑定信息</div>
        <!-- <div class="headerRight" onclick="openWin('register','register.html')">注册</div> -->
    </header>
    <section class="loginBox HTML_BOX">
          <div class="bg-eee" style="border-bottom:.2rem solid #EEE ; "></div>
            <ul class="loginForm plr">
                <li class="">
                    <span>账号</span>
                    <input placeholder="请输入手机号或邮箱" name="userName" />
                </li>
                <li class="">
                    <span>密码</span>
                    <input type="password" name="password" placeholder="请输入密码" />
                </li>
            </ul>
            <!-- <div class="displayFlex plr" style="margin-top: .25rem;color:#b2b2b2;">
                <div class="remember"><i class="icon"></i><span>记住密码</span></div>
                <div onclick="openWin('forgetPwd','forgetPwd.html')" class="forget"><i class="icon"></i><span>忘记密码</span></div>
            </div> -->
            <div class="loginBtn f_c">完成绑定</div>

            <!-- <div class="otherKinds">
                <div class="otherTitle">
                    <span>第三方登录</span>
                </div>
                <ul>
                    <li id="wxLogin"><img src="../image/20-box1.png" alt=""></li>
                    <li><img src="../image/20-box2.png" alt=""></li>
                </ul>
            </div> -->
    </section>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript">
    $(function () {
       $(".loginBox").css({
           'width': $(window).width(),
           'height': $(window).height(),
       });
        $(".userName,.userPwd").on('input',function () {
            if($(this).val()===''){
                $(this).removeClass("focus");
                $(this).siblings('span.delete').hide();
            }else {
                $(this).addClass("focus");
                $(this).siblings('span.delete').show();
            }
        });

        $(".delete").click(function () {
            $(".userName").val('').removeClass("focus");
            $(this).hide();
        });
        $(".loginBtn").click(function(){
	        var layers = "";
	        var isnull = false;
	        $(".loginForm input").each(function(i,item){
	            var val = $(item).val();
	            if(val == "" && !isnull){
	                switch(i){
	                    case 0:
	                    layers = "请输入手机号或邮箱";
                        if(cnen==2){
                            layers = 'Please enter your cell phone number or Email';
                        }
	                    isnull = true;
	                    break;
	                    case 1:
	                    layers = "请输入密码";
                        if(cnen==2){
                            layers = 'Please enter the validation code';
                        }
	                    isnull = true;
	                    break;
	                }
	            }
	        });
	        if(isnull){
	            console.log(layers);
	            pop.notice(layers);
	            return;
	        }
            pop.loading();
            var p = {
                number:$(".loginForm input").eq(0).val(),
                password:$(".loginForm input").eq(1).val(),
                type:"weixin",
                unionid:param.unionid,
                openid:param.openid,
                headimgurl:param.headimgurl,
                wxname:param.nickname,
            };
            getAjax(Interface.bang,p,function(res){
                pop.close();
                console.log(JSON.stringify(res));
                $api.setStorage('user',res.data);
                $api.setStorage('user_type',res.data.user_type);
                $api.setStorage('token',res.data.token);
                if($(".remember").hasClass("on")){
                   $api.setStorage('loginStorage',JSON.stringify({user:$(".loginForm input").eq(0).val(),password:$(".loginForm input").eq(1).val()}));
                }else{
                     $api.setStorage('loginStorage',null);
                }
                api.sendEvent({
                        name: 'reload',
                        extra: {}
                    });
                pop.notice('登录成功',1,function(){
                    historyBack();
                })
            },function(res,err){
                if(res){
                   pop.notice(res.msg);
                }
            })
	    });
    });
    $(".remember").click(function(){
        var ison = $(this).hasClass("on");//判断是否选中记住密码  ture为选中 flase为取消
        if(ison){
            $(this).removeClass("on");
        }else{
            $(this).addClass("on");
        }
    })
   
    var param;
    apiready = function(){
        $api.fixStatusBar($api.dom('header'));
        api.setStatusBarStyle({
            color: '#fff',//设置APP状态栏背景色
            style: 'dark'
        });
        param = api.pageParam;

        var login = $api.getStorage('loginStorage');
        if(login!=null){
            login = JSON.parse(login);
            $(".loginForm input").eq(0).val(login.user);
            $(".loginForm input").eq(1).val(login.password);
        }
        ifCnAndEn();
    };



</script>
<script type="text/javascript">
    function ifCnAndEn(){
        var html = '';
        if(cnen==2){
            $(".pageTitle").html('Login');
            $(".loginForm input").eq(0).attr('placeholder','Please enter your account number');
            $(".loginForm input").eq(1).attr('placeholder','Please input a password');
            $(".loginForm span").eq(0).html('Account');
            $(".loginForm span").eq(1).html('Password');
            $(".loginBox span").eq(2).html('Remember Password');
            $(".loginBox span").eq(3).html('Forgot Password?');
            $(".loginBox span").eq(4).html('Other landing');
            $(".headerRight").html('Sign Up');
            $(".loginBtn").html('Sign In');
        }
    }
</script>
</html>
